package cn.bandeqing.order.entity;

import cn.bandeqing.dispatch.req.MofifyDispatchStatusReq;
import cn.bandeqing.frame.mybatis.config.InsertOrUpdateListener;
import cn.bandeqing.frame.mybatis.entity.BaseEntity;
import cn.bandeqing.order.req.OrderCreateReq;
import cn.bandeqing.order.req.OrderModifyStatusReq;
import cn.bandeqing.order.req.OrderSaveOrUpdateReq;
import cn.bandeqing.wechatminiapp.req.OrderAppointmentReq;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.sql.Timestamp;

/**
 * 订单 实体类。
 *
 * @author fugui
 * @since 2024-01-07
 */
@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "bdq_order", onInsert = InsertOrUpdateListener.class, onUpdate = InsertOrUpdateListener.class)
@AutoMappers({
//        @AutoMapper(target = OrderCreateReq.class, convertGenerate = false),
        @AutoMapper(target = OrderSaveOrUpdateReq.class, convertGenerate = false),
        @AutoMapper(target = OrderModifyStatusReq.class, convertGenerate = false),
        @AutoMapper(target = MofifyDispatchStatusReq.class, convertGenerate = false),
        @AutoMapper(target = OrderAppointmentReq.class, convertGenerate = false),
})
public class Order extends BaseEntity {

    /**
     * 订单ID
     */
    @Id
    private Long orderId;

    private String customerName;

    private String customerPhone;

    private Timestamp serviceTime;

    private String startAddress;

    private Double startAddressLng;

    private Double startAddressLat;

    private Double distance;

    private String newAddress;

    private Double newAddressLng;

    private Double newAddressLat;

    private OrderStatus orderStatus;

    private Boolean dispatchStatus;

    private Timestamp handInTime;
    private Long handInUserId;
    private String handInUserName;

    private Timestamp writeOffTime;
    private Long writeOffUserId;
    private String writeOffUserName;

    private Long storeId;
    private String storeName;

    /**
     * 套餐总价
     */
    private Double productTotalPrice;

    /**
     * 优惠金额
     */
    private Double discountsPrice;
    /**
     * 其他费用
     */
    private Double otherPrice;

    /**
     * 总价
     */
    private Double totalPrice;

    /**
     * 应付定金
     */
    private Double shouldDeposit;

    // 实付定金
    private Double payDeposit;

    // 实付尾款
    private Double payFinalPayment;

    // 套餐信息
    private Long productId;
    private String productName;

    // 城市编码6位国家行政
    private String cityCode;
    private String cityName;

    private Integer startFloor;
    private Boolean startElevator;
    private Double startFloorPrice;

    private Integer newFloor;
    private Boolean newElevator;
    private Double newFloorPrice;

    private Double kmPrice;

    private String customerRemark;
    private String serviceRemark;
    private String orderRemark;

//    start_floor	int	11	0	True	False	False	0				起点楼层					0	False	False	False	False	False	False
//    start_elevator	tinyint	1	0	True	False	False	0				起点是否有电梯					0	False	False	False	False	False	False
//    start_floor_price	decimal	10	2	True	False	False	0				起点楼层费					0	False	False	False	False	False	False
//    new_floor	int	11	0	True	False	False	0				新家楼层					0	False	False	False	False	False	False
//    new_elevator	tinyint	1	0	True	False	False	0				新家是否有电梯					0	False	False	False	False	False	False
//    new_floor_price	decimal	10	2	True	False	False	0				新家楼层费					0	False	False	False	False	False	False
//    km_price	decimal	10	2	True	False	False	0				公里费					0	False	False	False	False	False	False


//    product_total_price	decimal	10	2	True	False	False	0				所有增值服务总价					0	False	False	False	False	False	False
//    discounts_price	decimal	10	2	True	False	False	0				优惠金额					0	False	False	False	False	False	False
//    total_price	decimal	10	2	True	False	False	0				总价					0	False	False	False	False	False	False
//    product_id	int	11	0	True	False	False	0				主显套餐					0	False	False	False	False	False	False
//    should_deposit	decimal	10	2	True	False	False	0				定金					0	False	False	False	False	False	False
//    pay_deposit	decimal	10	2	True	False	False	0				实付定金					0	False	False	False	False	False	False
//    pay_final_payment	decimal	10	2	True	False	False	0				实付尾款					0	False	False	False	False	False	False


}
